<?php
/************************FoxPHP威客系统************************/
/*                                                            */
/*  FoxPHP.Com (C)2006-2016 FoxPHP Inc.                       */
/*  This is NOT a freeware, use is subject to license terms   */
/*  FoxPHP威客系统是商业软件,使用于商业用途请购买授权         */
/*  V3.0 2016.3                                               */
/*  foxphp@aliyun.com                                         */
/*  http://www.foxphp.com                                     */
/*                                                            */
/**************************************************************/

namespace Category\Model;
use Think\Model;

class CategoryModel extends Model {
	
	public function GetTaskCategory(){
		$categoryonearr=$this->token(false)->where(" upid=0 AND task=1 ")->order('displayorder ASC')->select();
		$categoryjson=array();
		if($categoryonearr){
			   
			foreach($categoryonearr as $key=>$value){
				$categoryjson[$key]['name']=$value['name'];
				$categoryjson[$key]['catid']=$value['catid'];
				$categorytwoarr=$this->token(false)->where(" upid=".$value['catid']." AND task=1 ")->order('displayorder ASC')->select();
				$arraytwo=array();
				if($categorytwoarr){
					foreach($categorytwoarr as $keytwo=>$valuetwo){
						$arraytwo[$keytwo]['name']=$valuetwo['name'];
						$arraytwo[$keytwo]['catid']=$valuetwo['catid'];
					}
				}
				$categoryjson[$key]['array']=$arraytwo;
			}
		}
		return $categoryjson;
	}
}

?>